package com.live.stamp.base.common;

import com.live.stamp.web.user.model.TUser;

import java.util.HashMap;
import java.util.Map;

/**
 * model工具类
 */
public final class ModelUtil {
    private static Map<String, Object> loginUserMap = new HashMap<>();

    public void setUser(String token, TUser tUser) {
        loginUserMap.put(token, tUser);
        loginUserMap.put(tUser.getId(), tUser);
    }

    public static TUser getUserByToken(String token) {
        return (TUser) loginUserMap.get(token);
    }

    public static TUser getUserById(String userId) {
        return (TUser) loginUserMap.get(userId);
    }
}
